/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.mzk.kramerius.articles.importFromLn.domain;

import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Martin Řehánek (rehan@mzk.cz)
 */
public class ArticleComponent {

    private int volume;//rocnik
    private Issue issue; //vydani (datum, cislo, ranni/odpoledni/male)
    private NumberInterval pageInterval; //rozsah stran

    public static ArticleComponent instanceOf(int volume, Issue issue, NumberInterval pageInterval) {
        if (volume < 0) {
            Logger.getLogger(ArticleComponent.class.getName()).log(Level.WARNING, "volume<0");
            return null;
        }
        if (issue == null) {
            Logger.getLogger(ArticleComponent.class.getName()).log(Level.WARNING, "issue == null");
            return null;
        }
        if (pageInterval == null) {
            Logger.getLogger(ArticleComponent.class.getName()).log(Level.WARNING, "pageInterval == null");
            return null;
        }
        return new ArticleComponent(volume, issue, pageInterval);
    }

    private ArticleComponent(int volume, Issue issue, NumberInterval pageInterval) {
        this.volume = volume;
        this.issue = issue;
        this.pageInterval = pageInterval;
    }

    /**
     * @return the volume
     */
    public int getVolume() {
        return volume;
    }

    /**
     * @return the pageInterval
     */
    public NumberInterval getPageInterval() {
        return pageInterval;
    }

    /**
     * @return the issue
     */
    public Issue getIssue() {
        return issue;
    }
}
